using System;
using System.Collections.Generic;
using System.Text;

namespace GeoPlugIn
{
    //------------------------------------------------------------------------
    #region Class Mutation item

    public class Mutation
    {
        public string No;
        public string MutType;
        public string Date;
    
        // Parametrized C'tor
        public Mutation(string no, string type, string date)
        {
            this.No = no;
            this.MutType = type;
            this.Date = date;
        }

        // Default C'tor
        public Mutation()
        {
            No = MutType = Date = string.Empty;
        }

        // Helper
        public bool IsEmpty
        {
            get
            {
                 return No == string.Empty &&
                    MutType == string.Empty &&
                    Date == string.Empty;
            }
        }
    }

    #endregion

    //------------------------------------------------------------------------
    #region Mutation common CSV class

    public class CsvMutation : CsvBase
    {
        public string NoHistory;
        public string TypeRecord;
        public Mutation Inscription;
        public Mutation Radiation;

        public CsvMutation(string name, int nbCol, string csvRow)
            : base(name, nbCol, csvRow)
        {
        }
    }

    #endregion

    //------------------------------------------------------------------------
    #region District CSV class

    public class CsvDistrict : CsvMutation
    {
        public string CantonCode;
        private CsvCanton parentCanton;

        //Related canton
        public CsvCanton Canton
        {
            get { return parentCanton; }
            set { parentCanton = value; }
        }

        public CsvDistrict(string csvRow)
            : base("District", 13, csvRow)
        {
            // Fetch Info into properties
            NoHistory = Items[0].Trim();
            CantonCode = Items[1].Trim();
            Code = Items[2].Trim();
            OfficialTitle = Items[3].Trim();
            ShortTitle = Items[4].Trim();
            TypeRecord = Items[5].Trim();
            Inscription = new Mutation(Items[6].Trim(), Items[7].Trim(), Items[8].Trim());
            Radiation = new Mutation(Items[9].Trim(), Items[10].Trim(), Items[11].Trim());
            SysUpdateDt = Items[12].Trim();

            //Clear no more usage
            Items = null;

        }
    }

    #endregion

}
